import 'package:flutter/material.dart';
import 'package:flutter_woo_new/common/index.dart';
import 'package:get/get.dart';

import 'index.dart';

class StylesIndexPage extends GetView<StylesIndexController> {
  const StylesIndexPage({super.key});

  // 主视图
  Widget _buildView() {
    return Column(
      children: [
        // 切换样式
        ListTile(
          onTap: controller.onLanguageSelected,
          title: Text("语言：${ConfigService.to.locale.toLanguageTag()}"),
        ),

        // 切换主题
        ListTile(
          onTap: () => controller.onThemeSelected("light"),
          title: Text("亮色: ${ConfigService.to.themeMode}"),
        ),
        ListTile(
          onTap: () => controller.onThemeSelected("dark"),
          title: Text("暗色: ${ConfigService.to.themeMode}"),
        ),
        ListTile(
          onTap: () => controller.onThemeSelected("system"),
          title: Text("系统色: ${ConfigService.to.themeMode}"),
        ),

        // 文本调试
        ListTile(
          onTap: () => Get.toNamed(RouteNames.stylesText),
          title: Text("文本调试"),
        ),

        // 图片调试
        ListTile(
          onTap: () => Get.toNamed(RouteNames.stylesImage),
          title: Text("图片调试"),
        ),

        // 图标调试
        ListTile(
          onTap: () => Get.toNamed(RouteNames.stylesIcon),
          title: Text("图标调试"),
        ),

        // 按钮调试
        ListTile(
          onTap: () => Get.toNamed(RouteNames.stylesButton),
          title: Text("按钮调试"),
        ),

          // Input 输入框
        ListTile(
          onTap: () => Get.toNamed(RouteNames.stylesInput),
          title: const Text("Input 输入框"),
        ),

      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<StylesIndexController>(
      init: StylesIndexController(),
      id: "styles_index",
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: Text(LocaleKeys.stylesTitle.tr)),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
